package com.superb.util;

import lombok.Data;

import java.io.Serializable;

/**
 * @author Superb
 * @date 2020/11/8 - 11:40
 * @E_mail superb12580@163.com
 */
@Data
public class Result implements Serializable {
    //200正常 非200异常
    private int code;
    private String msg;
    private Object data;

    public Result() {
    }


    private Result(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success(String msg, Object data){
        return new Result(200, msg, data);
    }

    public static Result success(Object data){
        return new Result(200, "操作成功", data);
    }

    public static Result fail(String msg){
        return new Result(400, msg,null);
    }

    public static Result fail(){
        return new Result(400, "操作失败",null);
    }


}
